<template>
	<view>

		<template v-if="type == 1">

			<view class="goods" :class="type == 2 ? '' : ''">
				<!-- 	<view class="address">
					<div class="icon">
						<img :src="HTTP_IMG_UTL+'agencyIcon1.png'" class="headline_img" />
					</div>
					<view>
						<view class="label">{{$t("公司名称")}}</view>
						<view class="value"></view>
					</view>
				</view> -->
				<view class="company-title">
					<div class="span"></div>
					{{item[$t('item.company_name')] || $t("暂无信息") }}
				</view>
				<view style="margin-bottom: 20rpx;">
					<FromToCountry :item="item"></FromToCountry>
				</view>

				<view class="address">
					<div class="icon">
						<image :src='serverImageUrl("/static/newStyleIcon/line.png")' mode="widthFix" style="width: 70%;"
							class="headline_img" />
					</div>
					<view>
						<view class="label">{{$t("公司所在地")}}</view>
						<!-- <view class="value">{{item.companycitys[$t('item.city.mergename')] || $t("暂无信息") }}</view> -->
						<view class="value">{{item.hyd || $t("暂无信息") }}</view>
					</view>
				</view>
				<view class="address">
					<div class="icon">
						<image :src='serverImageUrl("/static/newStyleIcon/address.png")' mode="widthFix" style="width: 70%;"
							class="headline_img" />
					</div>
					<view>
						<view class="label">{{$t("通关口岸")}}</view>
						<!-- <view class="value">{{item.portcitys[$t('item.city.mergename')] || $t("暂无信息") }}</view> -->
						<view class="value">{{item.shd || $t("暂无信息") }}</view>
					</view>
				</view>

				<view class="type">
					<TransportType :item="item"></TransportType>
				</view>

			</view>
		</template>


		<template v-if="type == 2">

			<view class="goods" :class="type == 2 ? '' : ''">
				<view class="flexImg">
					<template v-if="item.images && item.images.length > 0">
						<u-image width="100%" height="300rpx" @click="preview(toImages(item.images[0]))"
							:src="toImages(item.images[0])">
						</u-image>
					</template>
					<template v-else>
						<u-image width="100%" height="300rpx"></u-image>
					</template>
				</view>
				<view class="imgFlex">
					<view class="label" style="margin-top: 24rpx;">
						{{item[$t('item.goods_name')]}}
					</view>
					<view v-if="item[$t('item.brand')]" class="label">{{$t("品牌")}}</view>
					<view v-if="item[$t('item.brand')]" class="text underline">
						{{item[$t('item.brand')]}}
					</view>

					<view class="lineP">
						<Tag style="padding: 0 50rpx;margin-rigth:40rpx" :text="item[$t('item.goods_weight')] + ' kg'"
							color="#008aff">
						</Tag>
						<Tag style="padding: 0 50rpx;margin-rigth:40rpx" :text="item[$t('item.goods_volume')] + ' m³'"
							color="#ff7200">
						</Tag>
						<Tag style="padding: 0 50rpx;" :text="item[$t('item.goods_num')]+item[$t('item.number_unit')]"
							color="#18d62a"></Tag>
					</view>

					<FromToCountry :item="item" style="margin-top: 15rpx;"></FromToCountry>


				</view>


				<view class="type">
					<TransportType :item="item"></TransportType>
				</view>



				<!--<view class="address">
					<view class="label">{{$t("货物所在地")}}</view>
					<img :src="HTTP_IMG_UTL+'agencyIcon3.png'" class="headline_img" />-->
				<!-- <view>{{item.departurecitys[$t('item.city.mergename')] || $t("暂无信息") }}</view> -->
				<!-- <view>{{item.hyd || $t("暂无信息") }}</view>-->
				<!--</view>-->
				
				

				<view class="address">
					<div class="icon">
						<image :src='serverImageUrl("/static/newStyleIcon/aa.png")' mode="widthFix" style="width: 70%;"
							class="headline_img" />
					</div>
					<div>
						<view class="label">{{$t("通关口岸")}}</view>
						<view class="value">{{item.shd || $t("暂无信息") }}</view>
					</div>
				</view>

				<view class="address" v-if="item.hwcfd">
					<div class="icon">
						<image :src='serverImageUrl("/static/newStyleIcon/line.png")' mode="widthFix" style="width: 70%;"
							class="headline_img" />
					</div>
					<div class="view">
						<view class="label">{{$t("出发城市")}}</view>
						<view class="value">{{item.hwcfd || $t("暂无信息") }}</view>
					</div>
				</view>

				<view class="address" v-if="item.hwddd">
					<div class="icon">
						<image :src='serverImageUrl("/static/newStyleIcon/address.png")' mode="widthFix" style="width: 70%;"
							class="headline_img" />
					</div>
					<div>
						<view class="label">{{$t("到达城市")}}</view>
						<view class="value">{{item.hwddd || $t("暂无信息") }}</view>
					</div>
				</view>

				<!-- <view class="address"  v-if="item.reachcitys&&item.reachcitys.mergename">
					<img :src="HTTP_IMG_UTL+'transportIcon1.png'" class="headline_img" />
					<view class="label">{{ $t('货物到达地') }}</view>
					<view v-if="lang=='zh'">{{item.reachcitys.mergename || $t("暂无信息") }}</view>
					<view v-if="lang!='zh'">{{item.reachcitys.mergename_ru || $t("暂无信息") }}</view>
				</view> -->
			</view>
		</template>

		<view class="goods" :class="type == 2 ? '' : ''">
			<view :class="type == 2 ? '' : ''">
				<span style="color:darkorange ; margin-right: 5px;">|</span>
				<text v-if="type === 1">{{$t('提供服务')}}</text>
				<text v-if="type === 2">{{$t('所需服务')}}</text>
			</view>
			<Server :item="item"></Server>
		</view>

		<view class="goods" :class="type == 2 ? '' : ''" v-if="type == 2">
			<ProductWHL :item="item" :type="type"></ProductWHL>
		</view>

	</view>
</template>

<script>
	import TransportType from '@/components/TransportType.vue'
	import FromToCountry from '@/components/FromToCountry.vue'
	import Tag from '@/components/Tag.vue'
	import ProductWHL from '@/components/ProductWHL.vue'
	import myTitle from "@/components/myTitle.vue";
	import Server from './Crossborder/Server.vue'
	import {
		ImageUrl,
		isBase64
	} from "@/common/public";
	import {
		IMAGE_URL,
		HTTP_IMG_UTL
	} from '@/config/app'
	export default {
		props: {
			item: {
				type: Object,
				default: {},
			},
			type: {
				type: String | Number,
				default: '1',
			},
		},
		data() {
			return {
				HTTP_IMG_UTL,
				lang: getApp().globalData.lang
			}
		},
		components: {
			Tag,
			TransportType,
			FromToCountry,
			myTitle,
			Server,
			ProductWHL
		},
		computed: {
			toImages() {
				return (src) => {
					return isBase64(src) ? src : IMAGE_URL + src
				}
			},
			storeImages() {
				return (sum, images) => [images[0]]
			},
		},
		methods: {
			ImageUrl,
			preview(path) {
				uni.previewImage({
					urls: [path],
					current: path
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.goods {
		width: 90%;
		border-radius: 8rpx;
		padding: 10px 12px;
		margin: 0 auto;
		margin-bottom: 20rpx;
		font-size: 30rpx;
		background-color: #fff;

		&.yellow {
			background: #fefcf6;
		}

		.underline {
			border-bottom: 1rpx solid #ccc;
			padding-bottom: 10rpx;
		}

		.label {
			font-weight: 800;
			margin-bottom: 10rpx;
		}

		.text {
			color: #666;
			margin-top: 15rpx;
		}

		.lineP {
			margin: 20rpx 0 30rpx 0;
		}

		.flexImg {
			display: flex;
			align-items: stretch;
			flex-direction: row;
			justify-content: space-evenly;

			.imgFlex {
				flex: 1;
				margin-left: 10px;
				display: flex;
				flex-direction: column;
			}
		}

		.type {
			display: flex;
			justify-content: space-between;
			align-items: flex-end;
			margin-top: 20rpx;
			margin-bottom: 20rpx;
			// padding-right: 22rpx;
			// width: 90%;
			// margin: 0 auto;
		}

		.address {
			margin-bottom: 32rpx;
			font-size: 28rpx;
			position: relative;
			display: flex;
			// font-weight: 600;

			// .warp {
			// 	width: 55%;
			// }

			.headline_img {
				width: 30rpx;
				height: 30rpx;

			}

			.label {
				font-weight: normal;
				margin-bottom: 10rpx;
				font-size: 24rpx;
				color: #666;
			}

			.value {
				color: #3d3d3d;
				font-size: 24rpx;
			}
		}
	}

	.icon {
		flex-shrink: 0;
		height: 70rpx;
		width: 70rpx;
		background-color: #F5F4F9;
		border-radius: 8rpx;
		margin-right: 24rpx;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.between {
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.company-title {
		display: flex;
		align-items: center;
		margin-bottom: 20rpx;
		font-size: 24rpx;
		font-weight: bold;
		justify-content: flex-start;

		.span {
			width: 8rpx;
			height: 36rpx;
			border-radius: 22rpx;
			background: linear-gradient(to bottom, #D9F0A3 0%, rgba(217, 240, 163, 0.411) 55%, rgba(201, 239, 49, 0) 100%);
			margin-right: 16rpx;
		}
	}
</style>